﻿<%@ Page Title="" Language="C#" MasterPageFile="~/Site.master" AutoEventWireup="true" CodeFile="listcustomersdeneme.aspx.cs" Inherits="listcustomersdeneme" %>
<%@ Import Namespace="System.Collections.Generic" %>
<%@ Import Namespace="System.Data" %>
<%@ Import Namespace="System.Xml.Xsl" %>
<%@ Import Namespace="System.Xml" %>
<%@ Import Namespace="System.Linq" %>
<%@ Import Namespace="System.Data.SqlClient" %>


<%@ Register Assembly="Ext.Net" Namespace="Ext.Net" TagPrefix="ext" %>


<asp:Content ID="Content1" ContentPlaceHolderID="HeadContent" runat="Server">
  
    <link href="../../../../resources/css/examples.css" rel="stylesheet" type="text/css" />

    <script type="text/javascript">
        var template = '<span style="color:{0};">{1}</span>';

        var change = function (value) {
            return String.format(template, (value > 0) ? "green" : "red", value);
        }

        var pctChange = function (value) {
            return String.format(template, (value > 0) ? "green" : "red", value + "%");
        }
    </script>
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="MainContent" runat="Server">
                    
        <ext:Store 
            ID="Store1" 
            runat="server" 
            OnRefreshData="Store1_RefreshData">
            <Reader>
                <ext:JsonReader>
                    <Fields>
                        <ext:RecordField Name="Id" />
                        <ext:RecordField Name="name" />
                        <ext:RecordField Name="surName" />
                        <ext:RecordField Name="tcNo" />
                        <ext:RecordField Name="createDate" />
                    </Fields>
                </ext:JsonReader>
            </Reader>
        </ext:Store>
        
        <ext:GridPanel 
            id="GridPanel1"
            runat="server" 
            StoreID="Store1" 
            Title="Customer List" 
            Width="790" 
            Height="320">
            <ColumnModel ID="ColumnModel1" runat="server">
                <Columns>
                    <ext:Column Header="Customer ID" DataIndex="Id" />
                    <ext:Column ColumnID="CustomerName" Header="Customer Name" DataIndex="name" />
                    <ext:Column Header="Customer Surname" DataIndex="surName" />
                    <ext:Column Header="Customer Citizenship Nu." DataIndex="tcNo" />
                    <ext:Column Header="Customer Create Date" DataIndex="createDate" />

                    <ext:CommandColumn Width="35">
                        <Commands>
                            <ext:GridCommand Icon="NoteEdit" CommandName="Edit">
                                <ToolTip Text="Edit" />
                            </ext:GridCommand>
                        </Commands>
                    </ext:CommandColumn>


                </Columns>
            </ColumnModel>
            <Listeners>
                <Command Handler="Ext.net.DirectMethods.viewClient(record.data.Id);" />
            </Listeners>

            <TopBar>
            <ext:Toolbar ID="Toolbar1" runat="server">
                <Items>
                    <ext:Button ID="Button1" runat="server" Text="Add" Icon="Add">
                        <Listeners>
                            <Click Handler="#{UserGrid}.insertRecord();#{UserGrid}.getRowEditor().startEditing(0);" />
                        </Listeners>
                    </ext:Button>
                    <ext:Button ID="Button2" runat="server" Text="Delete" Icon="Exclamation">
                        <Listeners>
                                <Click Handler="Ext.Msg.confirm('Delete Agent', 'Are you sure?');" /> <%-- çalışmazzz --%>                               
                                <%--Ext.Msg.alert('Click','Click on Delete');  --%>                            
                            </Listeners>
                    </ext:Button>
                    <ext:Button ID="Button3" runat="server" Text="View" Icon="User">
                        <Listeners>
                            <Click Handler="#{UserGrid}.viewSelected();" />
                        </Listeners>
                    </ext:Button>
                    <ext:Button ID="Button4" runat="server" Text="Edit" Icon="Pencil">
                        <Listeners>
                            <Click Handler="#{UserGrid}.editSelected();" />
                        </Listeners>
                    </ext:Button>
                </Items>
            </ext:Toolbar>
        </TopBar>
            <SelectionModel>
                <ext:RowSelectionModel ID="RowSelectionModel1" runat="server" />
            </SelectionModel>
            <LoadMask ShowMask="true" />
            <BottomBar>
                <ext:PagingToolbar ID="PagingToolbar1" runat="server" PageSize="10" StoreID="Store1" />
            </BottomBar>
        </ext:GridPanel>    
        
        
</asp:Content>
